package com.zhl.method;

public class MethodDemo2 {
    public static void main(String[] args) {
        printHello();
        PrintHello_forN(6);
    }


    //方法无返回数据，返回类型要写void
    //1.无参数无返回值类型
    public static void printHello(){
        for(int i=0;i<5;i++){
            System.out.println("Hello World! "+(i+1));
        }
    }

    //2.有参数无返回值类型
    //打印n次Hello World!
    public static void PrintHello_forN(int n)
    {
        System.out.println("正在为您打印"+n+"次Hello World!");
        for(int i=0;i<n;i++){
            System.out.println("Hello World! "+(i+1));
        }
    }

}
